﻿/* 
	======================================================================== 
		File name：		PurchasableDownloadHelper
		Module:			Mock some controller with unity injection 	
		Author：			David Gu(Master HaKu)
		Create Time：	2013/8/31
		Modify By:		
		Modify Date:	
	======================================================================== 
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using Zeus.Thunder.Web.Legacy;
using Zeus.Thunder.Web.ViewModels;
using Microsoft.Practices.ServiceLocation;
using Zeus.Thunder.Web.Download;
using log4net;

namespace Zeus.Thunder.Web.Controllers
{
    public class PurchasablePriceHistoryController : Controller
    {
        private readonly IPurchasableHelper purchasableDownloadHelper;
        
        public PurchasablePriceHistoryController(IPurchasableHelper purchasableDownloadHelper)
        {
            this.purchasableDownloadHelper = purchasableDownloadHelper;
        }

        public FileStreamResult GetDownloadFile(PurchasableCriteria criteria)
        {
            //prepare download data
            DownloadData data = purchasableDownloadHelper.GetDownloadData();

            //File Generator
            PurchasableFileGenerator generator = new PurchasableFileGenerator();

            return generator.Generate(criteria, data);
        }
    }
}



